package com.briup.app01.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.app01.bean.SalChance;
import com.briup.app01.bean.SalChanceExample;
import com.briup.app01.bean.SalChanceExample.Criteria;
import com.briup.app01.dao.SalChanceMapper;
import com.briup.app01.service.SalChanceService;
@Service
public class SalChanceServiceImpl implements SalChanceService {
	@Autowired
	private SalChanceMapper chanceMapper;
	public void saveOrUpdate(SalChance chance) {
		if(chance.getChcId()==null) {
			chanceMapper.insertSelective(chance);
		}else {
			chanceMapper.updateByPrimaryKey(chance);
	     }
	}
	public void deleteById(long id) {
		chanceMapper.deleteByPrimaryKey(id);
	}
	public SalChance selectById(long id) {
		return chanceMapper.selectByPrimaryKey(id);
	}
	
	public List<SalChance> select(String source, String cust_name,String title) {
		SalChanceExample example = new SalChanceExample();
/*    	Criteria criteria = example.createCriteria();
    	if(type!=null) {
    		criteria.andSvrTypeLike("%"+type+"%");
    	}
    	if(title!=null) {
    		criteria.andSvrTitleLike("%"+title+"%");
    }
    	if(status!=null) {
    		criteria.andSvrStatusLike("%"+status+"%");
    	}*/
    		return chanceMapper.selectByExample(example);
	}
	
	}
	
	
	
	
	